package org.devops

// 定义邮件内容
def Email(status, emailUser) {

    emailext body: """
            <!DOCTYPE html> 
            <html> 
            <head> 
            <meta charset="UTF-8"> 
            </head> 
            <body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4"  offset="0">   
                <img src="https://www.jenkins.io/images/logos/fire/fire.svg"> 
                <table width="95%" cellpadding="0" cellspacing="0"  style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">    
                    <tr>    
                        本邮件由系统自动发出，无需回复！<br/>            
                        各位同事，大家好，以下为${JOB_NAME}项目构建信息</br> 
                        <td><font color="#CC0000">构建结果 - ${status}</font></td>   
                    </tr>    
                    <tr>    
                        <td><br />    
                        <b><font color="#0B610B">构建信息</font></b>    
                        <hr size="2" width="100%" align="center" /></td>    
                    </tr>
                    <tr> 
                        <td> 
                            <ul> 
                                <li>Job Name: ${JOB_NAME}</li>
                                <li>Build Number: 第${BUILD_NUMBER}次构建</li>              
                                <li>Build Id: ${BUILD_ID}</li> 
                                <li>Build Status: ${status}</li>                         
                                <li>Build URL: <a href="${BUILD_URL}">${BUILD_URL}</a></li>    
                                <li>Build Log: <a href="${BUILD_URL}console">${BUILD_URL}console</a></li> 
                            </ul> 
                        </td> 
                    </tr>   
                </table> 
            </body> 
            </html>""",
            subject: "Jenkins - ${JOB_NAME} Build Information",
            to: emailUser
}
